/**
 * 配置各环境域名切换
 * 
 */
function getEnv() {
    var ego_pre_reg = /^(.*)(pre)(.*)(.cnsuning.com)$/,
        ego_sit_reg = /^(.*)([^2]sit)(.*)(.cnsuning.com)$/,
        ego_sit2_reg = /^(.*)(2sit)(.*)(.cnsuning.com)$/,
        _hostName = window.location.hostname;
    if (ego_pre_reg.test(_hostName)) {
    	return 'pre';
    } else if (ego_sit_reg.test(_hostName)) {
        return 'sit';
    } else if (ego_sit2_reg.test(_hostName)) {
        return 'sit2';
    }
    return 'prd';
}

switch (getEnv()) {
    case 'pre':
        var img = () => {
            return '//uimgpre.cnsuning.com';
        },
        routerMode = 'hash',
        my = '//mypre.cnsuning.com',
        aq = 'https://aqpre.cnsuning.com',
        snxd = 'http://snxdpre.cnsuning.com/cmwsmdm-web'
        break;
    case 'sit':
        var img = () => {
            return '//uimgsit.cnsuning.com';
        },
        routerMode = 'hash',
        my = '//mysit.cnsuning.com',
        aq = 'https://aqsit.cnsuning.com',
        snxd = 'http://snxdsit.cnsuning.com/cmwsmdm-web'
        break;
    case 'prd':
        // 生产
        var img = () => {
            let n = parseInt(Math.random() * 5 + 1);
            return '//image' + n + '.suning.cn'
        },
        routerMode = 'hash',
        my = '//my.suning.com',
        aq = 'https://aq.suning.com',
        snxd = 'http://snxd.suning.com/cmwsmdm-web'
        break;
};

export {
    routerMode, img, my, aq, snxd
}

